<?php
/**
 * @author Nguyễn Sơn Tùng <sontung.x305@gmail.com> <YM :terminator_nst>
 * @version 1.0
 * @copyright fteam.vn
 * Date: 23/04/2012
 * Time: 15:35
 */

Yii::setPathOfAlias('common',COMMON_FOLDER);
Yii::setPathOfAlias('frontend',FRONT_END);
Yii::setPathOfAlias('backend',BACK_END);
Yii::setPathOfAlias('resource',RESOURCES_FOLDER);


return array(

    'id'=> SITE_NAME,
    //Edit more information for your site here
    'name'=> SITE_NAME ,
    'sourceLanguage'=>'en_us',
    'language'=>'en',
    'localeDataPath'=>COMMON_FOLDER.'/i18n/data/',
    'charset'=>'utf-8',

    // preloading 'log' component
    'preload'=>array('log','translate','bootstrap'),

    // autoloading model and component classes
    // autoloading from the CMS and Common Folder
    'import'=>array(
        'application.models.*',
        'application.components.*',

        //Import Common Classes
        'common.components.*',
        'common.components.user.*',
        'common.components.actions.*',
        'common.extensions.*',
        'common.models.*',
        'common.models.user.*',
        'common.models.form.*',
        'common.models.setting.*',
        'common.modules.*',
        // Right module
        'common.modules.rights.*',
        'common.modules.rights.components.*',
        'common.modules.rights.model.*',
        'common.modules.rights.controllers.*',
        // Translate module
        'common.modules.translate.TranslateModule',
        'common.modules.translate.model.*',
        // bCrypt
        'common.vendors.crypt.*',
        // Bootstrap
        'common.extensions.bootstrap.widgets.*',
        // ImageHandler
        'common.extensions.ImageHandler.*',
        // File
        'common.extensions.file.*',
        // Validate
        'common.extensions.Validators.*'
    ),
    'modules'=>array(
        'rights'=>array(
            'class'=>'common.modules.rights.RightsModule',
            'install'=>false,	// Enables the installer.
            'superuserName'=>'Admin'
        ),
        'translate'=>array(
            'class'=>'common.modules.translate.TranslateModule',
        )
    ),
    // Application Event
    'onBeginRequest'=>array('FBeginRequest','startEvent'),
    'onEndRequest'=>array('FBeginRequest','endEvent'),
    // application components
    'components'=>array(

        //Edit your Database Connection here
        //Use MySQL database
        'db'=>array(
            'connectionString' => 'mysql:host=localhost;dbname=fcms',
            'schemaCachingDuration' => 3600,
            'emulatePrepare' => true,
            'username' => 'root',
            'password' => '654321@Abc',
            'charset' => 'utf8',
            'tablePrefix' => 'fcms_',
            'enableProfiling'=>true,    // for yii debug extension
            'enableParamLogging'=>true // for yii debug extension
        ),

        //Auth Manager
        'authManager'=>array(
            'class'=>'common.modules.rights.components.RDbAuthManager',
            'defaultRoles'=>array('Guest','Authenticated')
        ),
        // Translate
        'messages'=>array(
            'class'=>'CDbMessageSource',
            'onMissingTranslation' => array('TranslateModule', 'missingTranslation'),
            'sourceMessageTable'=>'{{translate_source_message}}', // Thay đổi bảng chứa source message
            'translatedMessageTable'=>'{{translate_message}}', // thay đổi tên bảng chứa message
        ),
        'translate'=>array(
            'class'=>'common.modules.translate.components.MPTranslate',
            'acceptedLanguages'=>array(
                'en'=>'English',
                'vi'=>'Tiếng Việt',
            ),
        ),
        'request'=>array(
            'class'=>'HttpRequest',
            'enableCookieValidation'=>true,
            'enableCsrfValidation'=> true,  // Cross-site Request Forgery Prevention
            'csrfTokenName'=>'FCMS_TOKEN',
            'noCsrfValidationRoutes'=>array() // Router noCSRF
        ),
        'browser' => array(
            'class' => 'common.extensions.browser.CBrowserComponent',
        ),
        'bootstrap' => array(
            'class' => 'common.extensions.bootstrap.components.Bootstrap',
            'responsiveCss' => true,
        ),
        //Use Cache System by File
        'cache'=>extension_loaded('apc') ?
            array(
                'class' => 'CApcCache',
            ) :
            array(
                'class' => 'CDbCache',
                'connectionID' => 'db',
                'autoCreateCacheTable' => true,
                'cacheTableName' => '{{cache}}',
            ),

        //Use the Settings Extension and Store value in Database
        'settings'=>array(
            'class'     => 'common.extensions.settings.CmsSettings',
            'cacheId'   => 'global_website_settings',
            'cacheTime' => 84000,
            'tableName'     => '{{settings}}',
            'dbComponentId'     => 'db',
            'dbEngine'      => 'InnoDB',
        ),
        // Save Session in database
        'session'=>array(
            'class' => 'CDbHttpSession',
            'connectionID' => 'db',
            'sessionTableName' => '{{session}}',
            'sessionName'=>'FCMSSESSIONID'
        ),
        // Image Handler
        'image'=>array(
            'class'=>'CImageHandler',
        ),
        // File
        'file'=>array(
            'class'=>'CFile',
        ),
        //Error Action when having Errors
        'errorHandler'=>array(
            // use 'site/error' action to display errors
            'errorAction'=>'fsite/error',
        ),
        'clientScript' => array(
            'coreScriptPosition'=>2,
        ),

        //Log the Site Error, Warning and Store into File
        'log'=>array(
            'class'=>'CLogRouter',
            'routes'=>array(
                array(
                    'class'=>'CFileLogRoute',
                    'levels'=>'error, warning',
                ),
                array(
                    'class'=>'common.extensions.yii-debug-toolbar.YiiDebugToolbarRoute',
                    'ipFilters'=>array('127.0.0.0'),
                ),
                // uncomment the following to show log messages on web pages
                /*
                    array(
                        'class'=>'CWebLogRoute',
                    ),
                     *
                     */

            ),
        ),
    ),

    // application-level parameters that can be accessed
    // using Yii::app()->params['paramName']
    // Don't use this, use the settings Components
    'params'=>array(

    ),
);